mediawiki.user: Clean up crypto version of generateRandomSessionId
authorTimo Tijhof <krinklemail@gmail.com>
Sat, 14 Feb 2015 10:03:55 +0000 (10:03 +0000)
committerNuria <nuria@wikimedia.org>
Mon, 16 Feb 2015 16:43:05 +0000 (16:43 +0000)
commit3ca5c2f423e922a167990cbfbbc5e10600077911
tree57043cceacca76da6cbc68466427ab3d8338713c
parentf26e34fa2866584f7a86f559578aab7b2bb35f7a
mediawiki.user: Clean up crypto version of generateRandomSessionId

Follows-up 4860ea3ca6.

* Documented how the byteToHex padding works.
* Move for-statement to after var and function declarations.
* Use permalink for git url (master will change, making the link
  less useful).
* Remove dead ", r" comma statement.
* Substitute 0x03 to match the other 3.
* Use 8 instead of arr.length. (Matching the other loops.)
* Use jQuery from closure instead of global $.
* Use $.trim instead of str.trim (new in ES5).
* Add test to assert consecutive return values are different.

Change-Id: I9f59cf60316091e435e4bc9dbd700b9c6e431dac
resources/src/mediawiki/mediawiki.user.js
tests/qunit/suites/resources/mediawiki/mediawiki.user.test.js